package com.maosy.demo.fragment.vm

import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.maosy.demo.api.CmsApi
import com.maosy.demo.api.HttpRequest
import com.maosy.demo.api.ServerHost
import com.maosy.demo.util.gson
import kotlinx.coroutines.launch

class HomeVM : ViewModel() {

    fun banner() {
        viewModelScope.launch {
            val banner = HttpRequest.getApi<CmsApi>(ServerHost.BASE_HOST).banner()
            Log.i(HomeVM::class.java.simpleName, "banner:${gson.toJson(banner)}")
        }
    }

}